<?php
/**
 * Vypisovaci modul pre diskovy priestor
 * @author Tomas Srna
 * @package bakalarka
 */

class SpaceWriter implements Writer
{
	public $raw = NULL;
	
	public function set($raw)
	{
		$this->raw = $raw;
		return $this;
	}
	
	public function __toString()
	{
		$raw = $this->raw;
		if($raw >= 1024)
			$raw = round($raw / 1024, 2) . " GB";
		else
			$raw = $raw . " MB";
		
		return F::he($raw); 
	}
	
	public function write()
	{
		echo (string)$this;
	}
}
